package com.yupi.springbootinit.mq;


import org.junit.jupiter.api.Test;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.boot.test.context.SpringBootTest;

import javax.annotation.Resource;

@SpringBootTest
public class RabbitMqDemo {


	@Resource
	private RabbitTemplate rabbitTemplate;



	@Test
	void mq() {
		// 交换机名称
		String exchangeName = BiMqConstant.BI_EXCHANGE_NAME;
		// 消息
		String message = "红色警报！日本乱排核废水，导致海洋生物变异，惊现哥斯拉！";
		// 发送消息
		rabbitTemplate.convertAndSend(exchangeName, BiMqConstant.BI_ROUTING_KEY, message);

	}
}
